import xlrd

# 1.workbook
workbook = xlrd.open_workbook(r'../a_datas/result_xlrd.xls')

# 2.sheet
sheets = workbook.sheets()  # 所有的sheet
sheets_name = workbook.sheet_names()  # 所有的sheet名字

sheet = workbook.sheet_by_name(u'2020年')
sheet_0 = workbook.sheets()[0]  # 按序列号
sheet_1 = workbook.sheet_by_index(1)  # 按序列号

sheet_name = sheet.name  # 名字
rows_num = sheet.nrows  # 行数
cols_num = sheet.ncols  # 列数

# 3.rows cols
row_values = sheet.row_values(2)  # 第2行所有值
col_values = sheet.col_values(3)  # 第3行所有值

row = sheet.row(2)
col = sheet.col(3)

# 4.cell
cell_value1 = sheet.cell(2, 3).value
cell_value2 = sheet.row(2)[3].value
cell_value3 = sheet.col(3)[2].value
cell_value3 = sheet.cell_value(2, 3)  # 2行3列

# 获取单元格中值的类型，类型 0 empty,1 string, 2 number, 3 date, 4 boolean, 5 error
cell_type = sheet.cell_value(1, 2)

print()
